// import axios from 'axios';
import ApiService from '../axios';
import axios from '@/api/interceptor';
import type * as Type from './filmRead.d';

// const preFix = 'test/';
const preFix = '';
// 获取标注序列
export const getAnnoArList = (data: Type.TaskParams) => {
  return axios.post<Type.ArListData>(preFix + 'anno/result/series/get', data);
}
export const getArList = (url: string, data: Type.TaskParams) => {
  return axios.post<Type.ArListData>(preFix + url, data);
}

// 获取基本征象，工具配置
export const getInitSettingData = (data: Type.TaskParams) => {
  return axios.post<Type.InItSettingsList>(preFix + 'anno/setting/read', data);
}
export const getInitSetData = (url: string, data: Type.TaskParams) => {
  return axios.post<Type.InItSettingsList>(preFix + url, data);
}

// 查看征象，工具配置结果
export const getInitResultData = (data: Type.ReadParams) => {
  return axios.post<Type.ReadResultData>(preFix + 'anno/result/read', data);
}
export const getResultData = (url: string, data: Type.ReadParams) => {
  return axios.post<Type.ReadResultData>(preFix + url, data);
}

// 新增保存标注
export const saveAnnoData = (data: Type.AddAnnoParams) => {
  return axios.post<Type.AddAnnoResult>(preFix + 'anno/lesion/result/point', data);
}

// 更新标注
export const updateAnnoData = (data: Type.UpdateAnnoParams) => {
  return axios.put<Type.DataCommonRes>(preFix + 'anno/lesion/result/point', data);
}

// 新增保存mask标注
export const saveMaskAnnoData = (data: Type.AddMaskAnnoParams) => {
  return axios.post<Type.AddAnnoResult>(preFix + 'anno/lesion/result/mask', data);
}

// 更新mask标注
export const updateMaskAnnoData = (data: Type.UpdateMaskAnnoParams) => {
  return axios.put<Type.DataCommonRes>(preFix + 'anno/lesion/result/mask', data);
}

/*// 大小征象批量新增 not used
export const saveCrListData = (data: Type.AddCrParams) => {
  return axios.post<Type.AddCrData>(preFix + 'anno/component/result', data);
}*/

// 更新大小征象批量
export const updateCrListData = (data: Type.UpdateCrParams) => {
  return axios.put<Type.DataCommonRes>('anno/component/result', data);
}
//大小征象的新增和更新
export const saveCrListData = (data: Type.SaveCrParams) => {
  return axios.post<Type.DataCommonRes>('/anno/component/result/save', data);
}

// 标注阴阳性
export const saveYaYData = (data: Type.SaveYaYParams) => {
  return axios.post<Type.DataCommonRes>(preFix + 'anno/result/yay', data);
}

// 标注最终提交
export const submitDataOver = (data: Type.SubmitOverParams) => {
  return axios.post<Type.DataCommonRes>(preFix + 'anno/result/submit', data);
}

// 删除病灶
export const delLesionData = (data: string) => {
  return axios.delete<Type.DataCommonRes>(preFix + `/anno/lesion/result/${data}`);
}

// 病理大图图像接口
export const getBigImageUrl = async (params: Type.GetBigImageUrlParams) => {
  const data = await ApiService.post<Type.GetBigImageUrlResponse>(preFix + "/anno/result/deepzoom/url", params);
  return data;
}